import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {

    list: [
      {
        id: 1,
        name: 'heilook',
        emit: 'hellok@123.com',
        picoe: 123448885,
        warr: '超级管理员',
        flag: false
      },
      {
        id: 2,
        name: 'heilook',
        emit: 'hefssf@123.com',
        picoe: 129858885,
        warr: '超级管理员',
        flag: false
      },
      {
        id: 3,
        name: 'heilook',
        emit: 'hdsfsdf@123.com',
        picoe: 123654885,
        warr: '超级管理员',
        flag: true
      },
      {
        id: 4,
        name: 'heilook',
        emit: 'heasfsaf@123.com',
        picoe: 123456785,
        warr: '超级管理员',
        flag: false
      },
    ],
    index: '',

    name:'',
    emit:'',
    picoe:''
  },
  mutations: {
    add(state, obj) {
      state.list.push({
        id: state.list.length + 1,
        name: obj.name,
        emit: obj.emit,
        picoe: obj.picoe,
        warr: '超级管理员'
      })
    },
    rem(state, index) {
      state.list.splice(index, 1)
    },
    xiu(state, obj) {
      state.index = obj.index
      state.name = state.list[index].name
      state.emit = state.list[index].emit
      state.picoe = state.list[index].picoe

      console.log(state.emit);
    }
  },
  actions: {
  },
  modules: {
  }
})
